import request from '@/utils/request'
import defaultSettings from '@/settings'

export const apiUrlConfig = {
  queryUrl: `${defaultSettings.ctx.authorityApp}/s/roleInfoApprove/search`,
  exportUrl: `${defaultSettings.ctx.authorityApp}/s/roleInfoApprove/search`,
  delUrl: `${defaultSettings.ctx.authorityApp}/s/roleInfoApprove/remove`,
}


// 审核通过
export function approve(data) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/roleInfoApprove/approve`,
    method: 'post',
    data:data,
  })
}


// 审核拒绝
export function reject(data) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/roleInfoApprove/reject`,
    method: 'post',
    data:data
  })
}

// 查询菜单列表
export function allMenuTreeNew(tenantCode) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/menuInfo/allMenuTreeNew?tenantCode=${tenantCode}`,
    method: 'get'
  })
}


// 查询角色菜单列表
export function listRoleMenuTmpList(query) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/menuInfo/roleMenuTreeNewTmp`,
    method: 'get',
    params: query
  })
}

// 查询角色菜单列表
export function checkRoleName(id,roleName) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/roleInfo/checkRoleNameUnique?roleName=${roleName}&id=${id}`,
    method: 'get'

  })
}

// 查询角色菜单列表
export function checkRoleKey(id,roleKey) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/roleInfo/checkRoleKeyUnique?roleKey=${roleKey}&id=${id}`,
    method: 'get'
  })
}

// 查询当前登陆人可看的租户列表
export function getMyTenants() {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/tenantInfo/getMyTenants`,
    method: 'get'
  })
}

export function userRolesByUserId(userId,deptId) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/roleInfo/getUserRolesByUserIdVue?userId=`+userId+`&deptId=`+deptId,
    method: 'get'
  })
};
